home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / misc / gms_dev.lha / GMS / Source / Asm / UsingObjects / ScreenObject.s < prev    next >
Encoding:
Text File  |  1997-07-05  |  3.4 KB  |  116 lines

  1. ;-------T-------T------------------------T---------------------------------;
  2. ;Name:      Objects Example
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions © 1996-1997.  Freely distributable.
  5. ;
  6. ;This demo will open a screen, based on the parameters in an external object
  7. ;file.  This allows a VERY high level of external editing that will alter
  8. ;how this program behaves, without having to reassemble it.
  9. ;
  10. ;This feature is highly important as it allows up to 100% configurability of
  11. ;your game, which previously has only been available to applications using
  12. ;libraries such as MUI.  However, it is even more powerful than this as
  13. ;graphic artists could not only create new datasets for your game, but also
  14. ;alter the dimensions, colours, resolution, attributes (and more) of your
  15. ;BOBs and screens.  Support for code segments is also available, so
  16. ;external functions could be altered and improved by programmers.  This will
  17. ;ensure that your game has a long lasting future as it keeps up with current
  18. ;technology and additions to GMS.
  19. ;
  20. ;I hope you make the most of external objects, its worth it!
  21.  
  22.     INCDIR    "INCLUDES:"
  23.     INCLUDE    "games/games_lib.i"
  24.     INCLUDE    "games/games.i"
  25.  
  26.     SECTION    "Objects",CODE
  27.  
  28. ;===========================================================================;
  29. ;                             INITIALISE DEMO
  30. ;===========================================================================;
  31.  
  32.     STARTGMS
  33.  
  34. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  35.     move.l    GMSBase(pc),a6
  36.     lea    OBJName(pc),a0
  37.     CALL    LoadObjectFile
  38.     move.l    d0,ObjectBase
  39.     beq    .Error_ObjectFile
  40.  
  41.     move.l    ObjectBase(pc),a0    ;a0 = Object Base.
  42.     lea    TXT_ScreenName(pc),a1    ;a1 = The name of the object to get.
  43.     CALL    GetObject    ;>> = Get our GameScreen object.
  44.     move.l    d0,Screen    ;a0 = Screen tags of our object.
  45.     beq.s    .Error_Screen    ;>> = Quit if error.
  46.  
  47.     move.l    ObjectBase(pc),a0    ;a0 = Object Base.
  48.     lea    TXT_PictureName(pc),a1    ;a1 = The name of the object to get.
  49.     CALL    GetObject    ;>> = Get our GameScreen object.
  50.     move.l    d0,Picture    ;>> = Picture tags of our object.
  51.     beq.s    .Error_Screen    ;>> = Quit if error.
  52.  
  53.     move.l    Screen(pc),a0    ;a0 = GameScreen tags
  54.     CALL    AddScreen    ;>> = Initialise the screen.
  55.     tst.l    d0    ;ma = Save pointer to the GameScreen.
  56.     beq.s    .Error_Screen    ;>> = Quit if error.
  57.  
  58.     move.l    Screen(pc),a0
  59.     move.l    Picture(pc),a1
  60.     move.l    GS_MemPtr1(a0),PIC_Data(a1)
  61.     CALL    LoadPic
  62.     tst.l    d0
  63.     beq.s    .Error_Picture
  64.  
  65.     move.l    Screen(pc),a0
  66.     move.l    Picture(pc),a1
  67.     move.l    PIC_Palette(a1),GS_Palette(a0)
  68.     CALL    UpdatePalette
  69.  
  70.     CALL    ShowScreen
  71.  
  72.     bsr.s    Main
  73.  
  74. .ReturnToDOS
  75.     move.l    GMSBase(pc),a6
  76.     move.l    Picture(pc),a1
  77.     CALL    FreePic
  78. .Error_Picture
  79.     move.l    Screen(pc),a0
  80.     CALL    DeleteScreen
  81. .Error_Screen
  82.     move.l    ObjectBase(pc),a0
  83.     CALL    FreeObjectFile
  84. .Error_ObjectFile
  85.     MOVEM.L    (SP)+,A0-A6/D1-D7
  86.     moveq    #ERR_OK,d0
  87.     rts
  88.  
  89. ;===========================================================================;
  90. ;                                MAIN LOOP
  91. ;===========================================================================;
  92.  
  93. Main:    CALL    WaitVBL
  94.     moveq    #JPORT1,d0
  95.     moveq    #JT_ZBXY,d1
  96.     CALL    ReadJoyPort
  97.     btst    #MB_LMB,d0
  98.     beq.s    Main
  99.     rts
  100.  
  101. ;===========================================================================;
  102. ;                                  DATA
  103. ;===========================================================================;
  104.  
  105. ObjectBase:    dc.l  0
  106. OBJName:    dc.b  "GMS:demos/data/OBJ.Screen",0
  107.         even
  108. Screen:        dc.l  0
  109. Picture:    dc.l  0
  110.  
  111. TXT_ScreenName:    dc.b  "Screen",0
  112.         even
  113. TXT_PictureName    dc.b  "Picture",0
  114.         even
  115.  
  116.